package info.androidhive.tabsswipe.adapter;

import info.androidhive.tabsswipe.Favourite;
import info.androidhive.tabsswipe.TheaterFragment;
import info.androidhive.tabsswipe.ThisWeekFragment;
import info.androidhive.tabsswipe.WillFragment;
import info.androidhive.tabsswipe.NowFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

public class TabsPagerAdapter extends FragmentPagerAdapter {

	public TabsPagerAdapter(FragmentManager fm) {
		super(fm);
	}

	@Override
	public Fragment getItem(int index) {

		switch (index) {
		case 0:
			// 本周新片
			return new ThisWeekFragment(0);
		case 1:
			// 即將上映
			return new WillFragment(1);
		case 2:
			// 現正熱映
			return new NowFragment(2);
		case 3:
			//電影院
			return new TheaterFragment();
		case 4:
			//我的最愛
			return new Favourite();
		}

		return null;
	} 

	@Override
	public int getCount() {
		// get item count - equal to number of tabs
		return 5;
	}

}
